package com.egoo.ticket.server.dao;

import com.egoo.ticket.server.pojo.entity.WorkOrder;
import com.egoo.ticket.server.pojo.entity.WorkOrderFilterMenu;
import com.egoo.ticket.server.pojo.vo.WorkOrderFilterMenuVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */

@Component
public interface WorkOrderFilterMenuDao {
	/**
	 * TODO 根据不同条件获取过滤器菜单列表
	 * @author: victor_tang
	 * @createtime: 2020/3/3 17:17
	 * @param searchMap 1
	 * @return: java.utils.List<com.egoo.ews.service.vo.WorkOrderFilterMenu>
	 */
	List<WorkOrderFilterMenu> selectFilterMenuListByCondition(Map<String, Object> searchMap);

	/**
	 * TODO 获取所有的过滤器菜单信息进行分页
	 * @param currentPage
	 * @param pageSize
	 * @param tenantId
	 * @return
	 */
	List<WorkOrderFilterMenu> selectAll(@Param("currentPage") Integer currentPage,
                                        @Param("pageSize") Integer pageSize,
                                        @Param("tenantId") String tenantId);

	/**
	 * 根据过滤器菜单Id获取过滤器菜单信息
	 * @param id
	 * @return
	 */
	WorkOrderFilterMenu selectById(@Param("id")Integer id,
								   @Param("tenantId")String tenantId);

	/**
	 * TODO 获取所有的过滤器菜单信息
	 * @param tenantId
	 * @return
	 */
	List<WorkOrderFilterMenu> selectAllMenu(@Param("tenantId") String tenantId);


	/**
	 * TODO 获取过滤器菜单的总条数
	 * @param tenantId
	 * @return
	 */
	Integer selectTotal(String tenantId);

	/**
	 * 获取当前过滤器菜单的最大排序
	 * @return
	 */
	Integer selectOrderMax();

	/**
	 * 根据过滤器菜单排序获取过滤器菜单
	 * @param ordering
	 * @return
	 */
	WorkOrderFilterMenu selectByOrdering(@Param("ordering")Integer ordering,
										 @Param("tenantId")String tenantId);

	/**
	 * 根据过滤器菜单名称和工单类型Id获取过滤器菜单信息
	 * @param name
	 * @param workOrderTypeId
	 * @return
	 */
	WorkOrderFilterMenu selectByEqualsName(@Param("name") String name,
                                           @Param("workOrderTypeId") Long workOrderTypeId,
										   @Param("tenantId")String tenantId);

	/**
	 * 新建过滤器菜单
	 * @param workOrderFilterMenu
	 * @return
	 */
	Integer  insertMenu(WorkOrderFilterMenu workOrderFilterMenu);

	/**
	 * 批量创建过滤器菜单
	 * @param list
	 * @return
	 */
    Integer insertByBatch(List list);

	/**
	 * 删除过滤器菜单
	 * @param workOrderFilterMenu
	 * @return
	 */
	Integer deleteMenu(WorkOrderFilterMenu workOrderFilterMenu);

	/**
	 * 更新过滤器菜单的使用状态
	 * @param workOrderFilterMenu
	 * @return
	 */
	Integer updateUseStatus(WorkOrderFilterMenu workOrderFilterMenu);

	/**
	 * 编辑过滤器菜单
	 * @param workOrderFilterMenu
	 * @return
	 */
	Integer updateContent(WorkOrderFilterMenu workOrderFilterMenu);

	/**
	 * 目前没用到
	 * @param status
	 * @return
	 */
	List<WorkOrderFilterMenuVo> selectByStatus(@Param("status") Integer status);

	/**
	 * 根据过滤器菜单的使用状态获取过滤器菜单信息
	 * @param status
	 * @return
	 */
	List<WorkOrderFilterMenu> selectByStatuss(@Param("status") Integer status);

	/**
	 * 批量更新过滤器菜单所属的工单类型信息
	 * @param updateMap
	 * @return
	 */
	Integer updateWorkOrderTypeByBatch(@Param(value = "updateMap") Map<String, Object> updateMap);

	/**
	 * 根据工单类型Id获取过滤器菜单信息
	 * @param workOrderTypeId
	 * @return
	 */
	List<WorkOrderFilterMenu> selectByWorkOrderTypeId(@Param("workOrderTypeId") Long workOrderTypeId);

//	List<Map> executeSql(Map map);

	/**
	 * 目前没用到
	 * @param sql
	 * @return
	 */
    List<WorkOrder> executeSql(@Param("sql") String sql);

//    Integer deleteBatchByWorkOrderTypeId(List<WorkOrderFilterMenu> workOrderFilterMenuList);

	/**
	 * 根据工单类型Id删除过滤器菜单信息
	 * @param workOrderTypeId
	 * @return
	 */
	Integer deleteByWorkOrderTypeId(@Param("workOrderTypeId") Long workOrderTypeId);

	/**
	 * TODO 根据不同条件删除过滤器菜单
	 * @author: victor_tang
	 * @createtime: 2020/5/20 15:02
	 * @param map 1
	 * @return: java.lang.Integer
	 */
	Integer deleteByCondition(Map<String, Object> map);

    List<WorkOrderFilterMenu> selectSysFilterMenu(@Param("workOrderTypeId") Long workOrderTypeId,
							 						@Param("tenantId") String tenantId);
    List<String> selectTenant();
}
